home *** CD-ROM | disk | FTP | other *** search
-
- kaleidoscope:
- read a text;
- clear screen;
- spread text over the screen;
- remove cursor.
-
- read a text:
- TEXT VAR t;
- put ("Text, please: ");
- get (t, 40).
-
- clear screen:
- put (ascii (1)).
-
- spread text over the screen:
- start in the middle;
- WHILE there is text left
- REP
- snip its head off;
- repeat its head symmetrically;
- choose a new position
- ENDREP.
-
- start in the middle:
- INT CONST midx :: 39;
- INT CONST midy :: 10;
- INT VAR i :: 1;
- INT VAR j :: 0.
-
- there is text left:
- t <> "".
-
- snip its head off:
- TEXT CONST head :: HEAD t;
- t := TAIL t.
-
- repeat its head symmetrically:
- show head in 4 orientations;
- mirror position;
- show head in 4 orientations;
- mirror position.
-
- show head in 4 orientations:
- UPTO 4
- REP
- show head;
- rotate left
- ENDREP.
-
- show head:
- cursor (midx + i, midy + j);
- put (head).
-
- rotate left:
- INT CONST oldi :: i;
- i := - j;
- j := oldi.
-
- mirror position:
- j := - j.
-
- choose a new position:
- j INCR 1;
- IF j = i
- THEN
- i INCR 1;
- j := 0
- FI.
-
- remove cursor:
- cursor (1, 2 * midy).
-
- ⇦